home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pcrob13.zip / LIB / PCROBOT6.PAS next >
Pascal/Delphi Source File  |  1992-10-29  |  5KB  |  281 lines

  1. unit PCRobots;
  2.  
  3. interface
  4.  
  5. const
  6.           Arena_Free = 0;
  7.           Arena_Wall = 1;
  8.           Arena_Damage = 3;
  9.           Arena_Refuel = 30;
  10.  
  11. type      Pattern_buffer=array[0..5] of shortint;
  12.           Patbuf_ptr=^Pattern_buffer;
  13.           Map_buffer=array[0..8,0..8] of shortint;
  14.           Mapbuf_ptr=^Map_buffer;
  15.  
  16. procedure Swaptask;
  17. procedure Movement(speed,angle:integer);
  18. function  Scan(angle,res:integer;var range:integer):integer;
  19. function  Shoot(angle,range:integer):integer;
  20. procedure Getxy(var x,y:integer);
  21. function  Transmit(target,data:integer):integer;
  22. function  Receive(var source,data:integer):integer;
  23. function  Damage:integer;
  24. function  Speed:integer;
  25. function  Battery:integer;
  26. function  Ticks:longint;
  27. function  L_Sin(angle:integer):longint;
  28. function  L_Cos(angle:integer):longint;
  29. function  L_Tan(angle:integer):longint;
  30. function  L_Atan(ratio:longint):integer;
  31. function  L_Sqrt(value:longint):longint;
  32. procedure Set_Pattern(Buffer:Patbuf_ptr);
  33. procedure Debug_Flag(flag,setflag:integer);
  34. procedure Buy_Armour(armour_units:integer);
  35. procedure Buy_Shells(shells:word);
  36. function  Shells_Left:integer;
  37. procedure Get_Local_Map(pntr:MapBuf_ptr);
  38. procedure Invisibility(invis_flag:integer);
  39. function  Get_Shell_Status:integer;
  40. function  IsInvisible:integer;
  41. function  L_Atan2(y,x:integer):integer;
  42. function Configure(speed,manouevre,range,armour,acceleration,invisibility:integer):integer;
  43.  
  44. implementation
  45.  
  46. uses DOS;
  47.  
  48. Const IntAddr = $E0;
  49.  
  50. procedure Swaptask; assembler;
  51. asm
  52.   mov  ax, 0
  53.   int  IntAddr
  54. end;
  55.  
  56. procedure Movement(speed,angle:integer); Assembler;
  57. asm
  58.   mov  ax, 1
  59.   mov  bx, Speed
  60.   mov  cx, Angle
  61.   int  IntAddr
  62. end;
  63.  
  64. function Scan(angle,res:integer;var range:integer):integer; Assembler;
  65. asm
  66.   mov  ax, 2
  67.   mov  bx, angle
  68.   mov  cx, res
  69.   int  IntAddr
  70.   mov  cx, bx
  71.   les  bx, Range
  72.   mov  es:[bx], cx
  73. end;
  74.  
  75. function Shoot(angle,range:integer):integer; Assembler;
  76. asm
  77.   mov  ax, 3
  78.   mov  bx, angle
  79.   mov  cx, range
  80.   int  IntAddr
  81. end;
  82.  
  83. procedure Getxy(var x,y:integer); Assembler;
  84. asm
  85.   mov  ax, $10
  86.   int  IntAddr
  87.   mov  dx, bx
  88.   les  bx, x
  89.   mov  es:[bx], dx
  90.   les  bx, y
  91.   mov  es:[bx], cx
  92. end;
  93.  
  94. function Transmit(target,data:integer):integer; assembler;
  95. asm
  96.   mov  ax, $11
  97.   mov  bx, target
  98.   mov  cx, data
  99.   int  IntAddr
  100. end;
  101.  
  102. function Receive(var source,data:integer):integer; Assembler;
  103. asm
  104.   mov  ax, $12
  105.   int  IntAddr
  106.   mov  dx, bx
  107.   les  bx, Source
  108.   mov  es:[bx], dx
  109.   les  bx, Data
  110.   mov  es:[bx], cx
  111. end;
  112.  
  113. function  Damage:integer; Assembler;
  114. asm
  115.   mov  ax, $13
  116.   int  IntAddr
  117.   mov  ax, bx
  118. end;
  119.  
  120. function  Speed:integer; Assembler;
  121. asm
  122.   mov  ax, $14
  123.   int  IntAddr
  124.   mov  ax, bx
  125. end;
  126.  
  127. function  Battery:integer; Assembler;
  128. asm
  129.   mov  ax, $15
  130.   int  IntAddr
  131.   mov  ax, bx
  132. end;
  133.  
  134. function  Ticks:longint; Assembler;
  135. asm
  136.   mov  ax, $16
  137.   int  IntAddr
  138.   mov  dx, bx
  139.   mov  ax, cx
  140. end;
  141.  
  142. function  L_Sin(angle:integer):longint; Assembler;
  143. asm
  144.   mov  ax, $17
  145.   mov  bx, angle
  146.   int  IntAddr
  147.   mov  dx, bx
  148.   mov  ax, cx
  149. end;
  150.  
  151. function  L_Cos(angle:integer):longint; Assembler;
  152. asm
  153.   mov  ax, $18
  154.   mov  bx, angle
  155.   int  IntAddr
  156.   mov  dx, bx
  157.   mov  ax, cx
  158. end;
  159.  
  160. function  L_Tan(angle:integer):longint; Assembler;
  161. asm
  162.   mov  ax, $19
  163.   mov  bx, angle
  164.   int  IntAddr
  165.   mov  dx, bx
  166.   mov  ax, cx
  167. end;
  168.  
  169. function  L_Atan(ratio:longint):integer; Assembler;
  170. asm
  171.   mov  ax, $1a
  172.   mov  bx, Word(Ratio +2)
  173.   mov  cx, Word(ratio)
  174.   int  IntAddr
  175. end;
  176.  
  177. function  L_Sqrt(value:longint):longint; Assembler;
  178. asm
  179.   mov  ax, $1b
  180.   mov  bx, Word (value +2)
  181.   mov  cx, Word (value)
  182.   int  IntAddr
  183.   mov  dx, bx
  184.   mov  ax, cx
  185. end;
  186.  
  187. procedure Set_Pattern(Buffer:Patbuf_ptr); Assembler;
  188. asm
  189.   mov  ax, $1c
  190.   mov  bx, Word (Buffer +2)
  191.   mov  cx, Word (Buffer)
  192.   int  IntAddr
  193. end;
  194.  
  195. procedure Debug_Flag(flag,setflag:integer); Assembler;
  196. asm
  197.   mov  ax, $1d
  198.   mov  bx, flag
  199.   mov  cx, setflag
  200.   int  IntAddr
  201. end;
  202.  
  203. procedure Buy_Armour(armour_units:integer); Assembler;
  204. asm
  205.   mov  ax, $1e
  206.   mov  bx, armour_units
  207.   int  IntAddr
  208. end;
  209.  
  210. procedure Buy_Shells(shells:word); Assembler;
  211. asm
  212.   mov  ax, $1f
  213.   mov  bx, shells
  214.   int  IntAddr
  215. end;
  216.  
  217. function  Shells_Left:integer; Assembler;
  218. asm
  219.   mov  ax, $20
  220.   int  IntAddr
  221.   mov  ax, bx
  222. end;
  223.  
  224. procedure Get_Local_Map(pntr:MapBuf_ptr); Assembler;
  225. asm
  226.   mov  ax, $21
  227.   mov  bx, word (pntr +2)
  228.   mov  cx, word (pntr)
  229.   int  IntAddr
  230. end;
  231.  
  232. procedure Invisibility(invis_flag:integer); Assembler;
  233. asm
  234.   mov  ax, $22
  235.   mov  bx, invis_flag
  236.   int  IntAddr
  237. end;
  238.  
  239. function Get_Shell_Status:integer; Assembler;
  240. asm
  241.   mov  ax, $23
  242.   int  IntAddr
  243.   mov  ax, bx
  244. end;
  245.  
  246. function IsInvisible:integer; Assembler;
  247. asm
  248.   mov  ax, $24
  249.   int  IntAddr
  250.   mov  ax, bx
  251. end;
  252.  
  253. function L_Atan2(y,x:integer):integer; Assembler;
  254. asm
  255.   mov  ax, $25
  256.   mov  bx, y
  257.   mov  cx, x
  258.   int  IntAddr
  259. end;
  260.  
  261. function Configure(speed,manouevre,range,armour,acceleration,invisibility:integer):integer;
  262. var
  263.   Pbx, Pcx : word;
  264.  
  265. begin
  266.   Pbx := (speed and 7) + ((manouevre and 7) shl 4) + ((range and 7) shl 8)+
  267.         ((armour and 7) shl 12);
  268.   Pcx := (acceleration and 7) + ((invisibility and 1) shl 3);
  269.  
  270.   asm
  271.     mov  ax, $80
  272.     mov  bx, Pbx
  273.     mov  cx, Pcx
  274.     int  IntAddr
  275.   end;
  276. end;
  277.  
  278. end.
  279.  
  280.  
  281.